package com.xh.cdp.sys.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.xh.cdp.sys.dao.SysMenuDao;
import com.xh.cdp.sys.dao.SysRoleMenuDao;
import com.xh.cdp.sys.entity.SysMenuEntity;
import com.xh.cdp.sys.entity.temp.ComboTreeModel;
import com.xh.cdp.sys.service.SysMenuService;

@Service
public class SysMenuServiceImpl implements SysMenuService {

	@Autowired
	private SysMenuDao sysMenuDao;

	@Autowired
	private SysRoleMenuDao sysRoleMenuDao;

	@Override
	public List<SysMenuEntity> showLeftMenuTree(String menuPid, String roleId) {
		return sysMenuDao.showLeftMenuTree(menuPid, roleId);
	}

	@Override
	public List<SysMenuEntity> listMenus(String id) {
		return sysMenuDao.listMenus(id);
	}

	@Override
	public List<SysMenuEntity> listParentMenus() {
		return sysMenuDao.listParentMenus();
	}

	@Override
	public String addMenu(SysMenuEntity sysMenuEntity) {
		return sysMenuDao.addMenu(sysMenuEntity);
	}

	@Override
	public List<Object> listMenuById(String id) {
		return sysMenuDao.listMenuById(id);
	}

	@Override
	public Integer deleteMenuById(String id) {
		return sysMenuDao.deleteMenuById(id);
	}

	@Override
	public void updateMenuById(SysMenuEntity sysMenuEntity, String id) {
		sysMenuDao.updateMenuById(sysMenuEntity, id);
	}

	@Override
	public List<ComboTreeModel> getPowerCombotree() {
		return sysMenuDao.getPowerCombotree();
	}

	@Override
	public List<ComboTreeModel> getPowerCombotree(String id) {
		List<String> ownMenuIds = sysRoleMenuDao.getOwnMenuIds(id);
		return sysMenuDao.getPowerCombotree(ownMenuIds);
	}

}
